const Sequelize = require('sequelize');
const baseModel = require('../baseModel');

class studentModel extends baseModel{
  constructor(){
    super('student',{
      // 学生id 主键
      id:{
        type: Sequelize.INTEGER,
        autoIncrement: true,
        allowNull: false,
        primaryKey:true
      },
      // 学生学号 主键
      learn_number:{
        type: Sequelize.STRING(16),
        allowNull: false,
        primaryKey:true
      },
      // 学生姓名
      name:{
        type: Sequelize.STRING(16),
        allowNull: false
      },
      // 微信ID
      openid:{
        type: Sequelize.STRING,
        allowNull: true
      },
      // 学生年龄
      grade:{
        type: Sequelize.STRING(10),
        allowNull: false
      },
      password:{
        type: Sequelize.STRING(16),
        allowNull: false
      },
      org:{
        type: Sequelize.INTEGER,
        allowNull: false
      },
      updatedAt:{
        type: Sequelize.DATE,
        allowNull: false,
      },
      createdAt:{
        type: Sequelize.DATE,
        allowNull: false
      }
    });
    this.model = super.getModel();
    this.model.sync();
  }
}

module.exports = new studentModel();
